﻿<vw:PhoneApplicationPageBase
    x:Class="WaitLess.App.Views.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:vw="clr-namespace:WaitLess.App.Views"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    d:DataContext="{d:DesignData MainPageDesignDataContext.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    ApplicationBar="{StaticResource GlobalAppBar}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="#2A2A2A">
        <toolkit:PerformanceProgressBar x:Name="performanceProgressBar" IsIndeterminate="True"
                                        VerticalAlignment="Top" Visibility="{Binding IsDataLoaded, Converter={StaticResource isDataLoadedToVisibilityConverter}}" />

        <!--Pivot Control-->
        <controls:Pivot Title="WachtMinderInA">
            <!--Pivot item one-->
            <controls:PivotItem Header="Districtshuis">
                <ListBox x:Name="DistrictshuisListBox" Margin="0,0,-12,0" ItemsSource="{Binding Districtshuizen}" SelectedItem="{Binding SelectedMunicipalOffice, Mode=TwoWay}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="0,0,0,17" Width="432" Height="78"
                                        Background="#CB0B3C">
                                <Image Source="{Binding Id, Converter={StaticResource municipalOfficeToImageConverter}}" 
                                   Stretch="UniformToFill" Width="80" ImageFailed="Image_ImageFailed"></Image>

                                <StackPanel>
                                    <TextBlock Text="{Binding Title, Converter={StaticResource municipalOfficeNameToTitleConverter}}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Margin="22,-4,2,0"
                                               Foreground="White"/>
                                    <TextBlock Text="{Binding District}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}"
                                               Foreground="#F38F11"/>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem Header="Stadskantoor">
                <ListBox x:Name="StadskantoorListBox" Margin="0,0,-12,0" ItemsSource="{Binding Stadskantoren}" SelectedItem="{Binding SelectedMunicipalOffice, Mode=TwoWay}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="0,0,0,17" Width="432" Height="78"
                                        Background="#CB0B3C">
                                <Image Source="{Binding Id, Converter={StaticResource municipalOfficeToImageConverter}}" 
                                   Stretch="UniformToFill" Width="80" ImageFailed="Image_ImageFailed"></Image>

                                <StackPanel>
                                    <TextBlock Text="{Binding Title, Converter={StaticResource municipalOfficeNameToTitleConverter}}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Margin="22,-4,2,0"
                                               Foreground="White"/>
                                    <TextBlock Text="{Binding District}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}"
                                               Foreground="#F38F11"/>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>


</vw:PhoneApplicationPageBase>